
include ../conf.mk

## Common C-Sharp related stuff
CSC=Csc.exe

# preprocessor
PP=gcc.exe
PPARG=-E -C -w $(DEFINEARG) -x c++

## Common Famine build configuration.
FAMINE_TARGETS = core/main
DEFINES = KAKKA PYLLY

FAMINEPATH=.
SRCDIR = $(FAMINEPATH)/src
TMPSRCDIR = $(FAMINEPATH)/tmp/src

## Some kool wanks
SRC = $(addsuffix .csi, $(addprefix $(SRCDIR)/, $(basename $(FAMINE_TARGETS))))
PREPROCESSED_SRC = $(addsuffix .cs, $(addprefix $(TMPSRCDIR)/, $(subst /,_, $(basename $(FAMINE_TARGETS)))  ))
DEFINEARG = $(addprefix -D, $(DEFINES))

%.cs:
%.csi:

include Makefile.xna

all: stat preprocess

stat: 
	@echo Targets:                   $(FAMINE_TARGETS)
	@echo Source files:              $(SRC)
	@echo Preprocessed source files: $(PREPROCESSED_SRC)
	@echo Compiler:                  $(CSCPATH)/$(CSC)
	@echo Defines:                   $(DEFINES)
	@echo Preprocess:                $(GCCPATH)/$(PP) $(PPARG)
	@echo ---
	
$(PREPROCESSED_SRC): $(SRC)
	$(GCCPATH)/$(PP) $(PPARG) $? -o $@

preprocess-begin:
	@echo Begin preprocessing.

preprocess: preprocess-begin $(PREPROCESSED_SRC)

clean:
	-rm tmp/src/*
